package com.xiaotu.service.sw.impl;

import com.xiaotu.dao.sw.SwLeaveMsgMapper;
import com.xiaotu.dao.tip.MsgTipMapper;
import com.xiaotu.model.MsgTipModel;
import com.xiaotu.model.SwLeaveMsgModel;
import com.xiaotu.service.sw.SwLeaveMsgService;
import com.xiaotu.vo.SwLeaveMsgVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zhangxiao
 * @create 2021-09-06 10:42
 */
@Service
@Transactional
public class SwLeaveMsgServiceImpl implements SwLeaveMsgService {

    @Autowired
    private SwLeaveMsgMapper swLeaveMsgMapper;

    @Autowired
    private MsgTipMapper msgTipMapper;

    @Override
    public Object submitSwLeaveMsg(SwLeaveMsgModel swLeaveMsg) {
        swLeaveMsgMapper.insert(swLeaveMsg);
        msgTipMapper.updateByPrimaryKey(new MsgTipModel(2, 0));
        return null;
    }

    @Override
    public List<SwLeaveMsgVo> getSwLeaveMsg(Integer beLeaveMsgUserId) {
        return swLeaveMsgMapper.getSwLeaveMsg(beLeaveMsgUserId);
    }

}

